package com.zzx.dal.repository;

import com.alibaba.dubbo.config.annotation.Service;
import com.zzx.common.dal.bean.OrderInfoDO;
import com.zzx.common.dal.repository.OrderRepository;
import com.zzx.dal.mapper.OrderMapper;
import com.zzx.dal.model.OrderInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Service(interfaceClass = OrderRepository.class)
@Slf4j
public class OrderRepositoryImpl implements OrderRepository {

    @Autowired
    private OrderMapper orderMapper;


    @Override
    public OrderInfoDO getOrderInfo(String id) {
        OrderInfoDO orderInfoDO = new OrderInfoDO();
        OrderInfo orderInfo = orderMapper.selectById(id);
        log.info("捞取订单数据成功，详情：{}",orderInfo.toString());
        BeanUtils.copyProperties(orderInfo, orderInfoDO);
        return orderInfoDO;
    }
}
